#include <queue>
#include <iostream>


/**
 * 入队
 */
void Test01() {
	std::queue<int> q;
	q.push(1);
	q.push(2);
	q.push(3);
	q.push(4);
	q.push(777);

	std::cout << "队列大小:" << q.size() << std::endl;
	std::cout << "队头元素:" << q.front() << std::endl;
	std::cout << "队尾元素:" << q.back() << std::endl;
}

/**
 * 遍历
 */
void Test02() {
	std::queue<int> q;
	q.push(1);
	q.push(2);
	q.push(3);
	q.push(4);
	q.push(777);

	std::cout << "队列大小:" << q.size() << std::endl;

	while (!q.empty()) {
		//看一眼队头元素
		std::cout << q.front() << std::endl;
		//出队
		q.pop();
	}

	std::cout << "队列大小:" << q.size() << std::endl;


}


int main() {

	//Test01();
	Test02();


	return 0;
}